home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / YERK / SUPPLEME / MY_STUFF / VBLS < prev    next >
Text File  |  1991-04-29  |  1KB  |  57 lines

  1. \ 4.6.87    rfl    vbl queue manipulation
  2. \ 1.1.88    rfl    general cleanup
  3.  
  4. :code vinstall 
  5.     move.l (a7)+,a0
  6.     call vinstall
  7.     ext.l    d0
  8.     move.l    d0,-(a7)
  9. ;code
  10.  
  11. :code vremove
  12.     move.l (a7)+,a0
  13.     call vremove
  14.     ext.l    d0
  15.     move.l    d0,-(a7)
  16. ;code
  17.     
  18.  
  19.  
  20. :CLASS vbl <super object
  21.  
  22.     var            qlink
  23.     int            qtype
  24.     var            procPtr
  25.     int            vblCount
  26.     int            vblPhase
  27.  
  28. ( 1/60ths of second -- )
  29.   :M SetDelay: put: vblCount ;M
  30.  
  31. ( cfaProc -- errcode)
  32.   :M install: >body +base put: procptr abs: self vinstall abort" install error" ;M
  33.  
  34. ( -- errcode)
  35.   :M remove: abs: self vremove . ;M
  36.  
  37.   :M classinit: 1 put: qtype ;M
  38.  
  39. ;class
  40.  
  41. vbl myTask
  42.  
  43. \ Now to use this, create a :proc definition which is the background task
  44. \ you want to perform. You can set the delay (in 1/60ths
  45. \ of a second) for periodic execution using the setDelay: method.  The
  46. \ task itself must reset this delay everytime it executes.  The task
  47. \ should ultimately be written in assembly, since all other events
  48. \ are on hold while your word is being executed.
  49.  
  50. \ example below
  51.  
  52. \ :Proc beeper 1 beep 120 setdelay: myTask ;proc
  53. \ 120 setdelay: myTask
  54. \ 'c beeper install: myTask
  55. \ to remove, say remove: myTask
  56.  
  57.